package com.freesky.biz.abchina.controller;

import com.freesky.biz.abchina.domain.TMaotaiCountRecord;
import com.freesky.biz.abchina.domain.TMaotaiRecord;
import com.freesky.biz.abchina.domain.TMaotaiShare;
import com.freesky.biz.abchina.domain.TMonthGoldRecord;
import com.freesky.biz.abchina.service.IMaotaiRecordService;
import com.freesky.biz.abchina.service.IMonthGoldRecordService;
import com.freesky.common.annotation.Log;
import com.freesky.common.core.controller.BaseController;
import com.freesky.common.core.domain.AjaxResult;
import com.freesky.common.core.page.TableDataInfo;
import com.freesky.common.enums.BusinessType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

@RestController
@RequestMapping("/abchina/monthgold/")
public class MonthGoldController extends BaseController {

    @Autowired
    private IMonthGoldRecordService monthGoldRecordService;

    /**
     * 抢茅台列表
     */
    @PreAuthorize("@ss.hasPermi('abchina:monthgold:list')")
    @GetMapping("/list")
    public TableDataInfo list(TMonthGoldRecord monthGoldRecord) {
        startPage();
        List<TMonthGoldRecord> list = monthGoldRecordService.findList(monthGoldRecord);
        return getDataTable(list);
    }

    @Log(title = "月月超金喜", businessType = BusinessType.EXPORT)
    @PreAuthorize("@ss.hasPermi('abchina:monthgold:export')")
    @GetMapping("/export")
    public AjaxResult export(TMonthGoldRecord monthGoldRecord,
                             HttpServletResponse response) {
        return monthGoldRecordService.exportFile(monthGoldRecord);
    }

}
